/// @file PerfBlock.hh
/// @brief Structure to return consolidated performance information
///
// *************************************************************************

// Copyright© 2010 Texas A&M University, 
//                 College Station, Texas
//                 Contact: R Crosby <rwc@cs.tamu.edu>
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program.  If not, see <http://www.gnu.org/licenses/>.

// *************************************************************************

#ifndef PERFBLOCK_HH
#define PERFBLOCK_HH

#include <sys/time.h>

// *************************************************************************
/// @brief OS Common performance fields

struct PerfBlock {

    // Timing fields from the rusage block

    timeval       userTime;			  // User CPU time
    timeval       sysTime;			  // System CPU time

    // Paging information from the rusage block (linux only)
    
    unsigned long minorFaults;			  // Page faults (no I/O)
    unsigned long majorFaults;			  // Page faults (I/O)

    unsigned long volContextSw;			  // Voluntary context switches
    unsigned long involContextSw;		  // Involuntary context switches

    // Fields calculated per OS

    unsigned long resPrivate;			  // Private resident memory (bytes)
    unsigned long virPrivate;			  // Private virtual memory (bytes)
    unsigned long virSize;			  // Total virtual (private + shared)

};

// *************************************************************************
/// @brief Function to return performance info
/// @param pb Point to area to return info
/// @return 0 if OK, 1 if an error

int GetPerformanceInfo ( PerfBlock * pb );

#endif
